package com.dapeis.web.wx.wx.handler;

import java.util.Map;

import me.chanjar.weixin.common.session.WxSessionManager;
import me.chanjar.weixin.mp.api.WxMpMessageHandler;
import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.bean.WxMpXmlMessage;
import me.chanjar.weixin.mp.bean.WxMpXmlOutMessage;
import me.chanjar.weixin.mp.bean.WxMpXmlOutTextMessage;

import org.springframework.stereotype.Component;

import com.ag.utils.DictionarySettingUtils;

/**
 * 
 * Title:WxEventCustomerServiceHandler.java WxEventCustomerServiceHandler
 * Description:
 * @author yuanyong
 * @date 2017年4月18日 上午9:23:52 
 * Email: hzyuanyong@126.com
 *
 */
@Component
public class WxEventCustomerServiceHandler implements WxMpMessageHandler {
	@Override
	public WxMpXmlOutMessage handle(WxMpXmlMessage wxMessage,
			Map<String, Object> context, WxMpService wxMpService,
			WxSessionManager sessionManager) {
		WxMpXmlOutTextMessage m = WxMpXmlOutMessage
				.TEXT()
				.content(DictionarySettingUtils.getParameterValueWithDefault(
						"wx_webapp.customer_message.text", "客服信息未设置"))
				.fromUser(wxMessage.getToUserName())
				.toUser(wxMessage.getFromUserName()).build();
		return m;
	}

}
